<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>${constants.getSystemName()}</title>
    <link rel="stylesheet" href="${ctxPath}/assets/common/libs/layui/css/layui.css?v=${constants.getReleaseVersion()}"/>
    <link rel="stylesheet" href="${ctxPath}/assets/common/module/admin.css?v=${constants.getReleaseVersion()}"/>
    <link rel="stylesheet" href="${ctxPath}/assets/expand/css/style.css?v=${constants.getReleaseVersion()}" media="all"/>
</head>
<body>
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15" >
            <div class="layui-col-xs12 layui-col-sm6 layui-col-md4">
                <div class="layui-card">
                    <div class="layui-card-body">
                        <div id="currentSession" style="width: 100%;min-height:300px"></div>
                    </div>
                </div>
            </div>
            <div class="layui-col-xs12 layui-col-sm6 layui-col-md4">
                <div class="layui-card">
                    <div class="layui-card-body">
                        <div id="maxSession" style="width: 100%;min-height:300px"></div>
                    </div>
                </div>
            </div>
            <div class="layui-col-xs12 layui-col-sm6 layui-col-md4">
                <div class="layui-card">
                    <div class="layui-card-body">
                        <div id="maxSeconds" style="width: 100%;min-height:300px"></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row layui-col-space15" >
            <div class="layui-col-xs12 layui-col-sm6 layui-col-md4">
                <div class="layui-card">
                    <div class="layui-card-body">
                        <div id="createTotal" style="width: 100%;min-height:300px"></div>
                    </div>
                </div>
            </div>
            <div class="layui-col-xs12 layui-col-sm6 layui-col-md4">
                <div class="layui-card">
                    <div class="layui-card-body">
                        <div id="rejectTotal" style="width: 100%;min-height:300px"></div>
                    </div>
                </div>
            </div>
            <div class="layui-col-xs12 layui-col-sm6 layui-col-md4">
                <div class="layui-card">
                    <div class="layui-card-body">
                        <div id="expiredTotal" style="width: 100%;min-height:300px"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- js部分 -->
    @/* 加入contextPath属性和session超时的配置 */
    <script type="text/javascript">
        var Feng = {
            ctxPath: "${ctxPath}",
            version: '${constants.getReleaseVersion()}'
        };
    </script>
    <script type="text/javascript" src="${ctxPath}/assets/common/libs/layui/layui.js?v=${constants.getReleaseVersion()}"></script>
    <script type="text/javascript" src="${ctxPath}/assets/common/js/common.js?v=${constants.getReleaseVersion()}"></script>
    <script src="${ctxPath}/assets/common/libs/echarts/echarts.min.js?v=${constants.getReleaseVersion()}"></script>
    <script src="${ctxPath}/assets/common/libs/echarts/echartsTheme.js?v=${constants.getReleaseVersion()}"></script>
    <script>
        layui.use(['layer'], function () {
            const $ = layui.jquery;
            initCurrentSession();
            initMaxSession();
            initMaxSeconds();
            initCreateTotal();
            initRejectTotal();
            initExpiredTotal();
            function initCurrentSession(){
                const currentSession = echarts.init(document.getElementById('currentSession'), myEchartsTheme);
                let currentSessionData = ${tomcat_sessions_active_current_sessions};
                const option = {
                    title: { text: 'Current Sessions', x: 'center' },
                    tooltip: { trigger: 'axis' },
                    xAxis: {
                        type: 'time'
                    },
                    yAxis: {
                        type: 'value',
                        scale: true
                    },
                    series: [{type : 'line', name : 'Current Sessions', data: currentSessionData, showSymbol: true}]
                };
                currentSession.setOption(option);
            }
            function initMaxSession(){
                const maxSession = echarts.init(document.getElementById('maxSession'), myEchartsTheme);
                let maxSessionData = ${tomcat_sessions_active_max_sessions};
                const option = {
                    title: { text: 'Max Sessions', x: 'center' },
                    tooltip: { trigger: 'axis' },
                    xAxis: {
                        type: 'time'
                    },
                    yAxis: {
                        type: 'value',
                        scale: true
                    },
                    series: [{type : 'line', name : 'Max Sessions', data: maxSessionData, showSymbol: true}]
                };
                maxSession.setOption(option);
            }
            function initMaxSeconds(){
                const maxSeconds = echarts.init(document.getElementById('maxSeconds'), myEchartsTheme);
                const maxSecondsData = ${tomcat_sessions_alive_max_seconds};
                const option = {
                    title: { text: 'Max Seconds', x: 'center' },
                    tooltip: { trigger: 'axis' },
                    xAxis: {
                        type: 'time'
                    },
                    yAxis: {
                        type: 'value',
                        scale: true
                    },
                    series: [{type : 'line', name : 'Max Seconds', data: maxSecondsData, showSymbol: true}]
                };
                maxSeconds.setOption(option);
            }
            function initCreateTotal(){
                const createTotal = echarts.init(document.getElementById('createTotal'), myEchartsTheme);
                const createTotalData = ${tomcat_sessions_created_sessions_total};
                const option = {
                    title: { text: 'Total Create', x: 'center' },
                    tooltip: { trigger: 'axis' },
                    xAxis: {
                        type: 'time'
                    },
                    yAxis: {
                        type: 'value',
                        scale: true
                    },
                    series: [{type : 'line', name : 'Total Create', data: createTotalData, showSymbol: true}]
                };
                createTotal.setOption(option);
            }
            function initRejectTotal(){
                const rejectTotal = echarts.init(document.getElementById('rejectTotal'), myEchartsTheme);
                const rejectTotalData = ${tomcat_sessions_rejected_sessions_total};
                const option = {
                    title: { text: 'Total Reject', x: 'center' },
                    tooltip: { trigger: 'axis' },
                    xAxis: {
                        type: 'time'
                    },
                    yAxis: {
                        type: 'value',
                        scale: true
                    },
                    series: [{type : 'line', name : 'Total Reject', data: rejectTotalData, showSymbol: true}]
                };
                rejectTotal.setOption(option);
            }
            function initExpiredTotal(){
                const expiredTotal = echarts.init(document.getElementById('expiredTotal'), myEchartsTheme);
                const expiredTotalData = ${tomcat_sessions_expired_sessions_total};
                const option = {
                    title: { text: 'Total Expired', x: 'center' },
                    tooltip: { trigger: 'axis' },
                    xAxis: {
                        type: 'time'
                    },
                    yAxis: {
                        type: 'value',
                        scale: true
                    },
                    series: [{type : 'line', name : 'Total Expired', data: expiredTotalData, showSymbol: true}]
                };
                expiredTotal.setOption(option);
            }
        });
    </script>
</body>
</html>